/******************************************
  提供几个数据库操作的函数
  ******************************************/
#ifndef DB_H
#define DB_H
#include <QtCore>
#include <QHostAddress>
class QSqlQuery;
class QTimer;
class DatabaseOperation : public QObject
{
    Q_OBJECT
public:
    DatabaseOperation(QObject* parent=0);
    bool createConnection(const QString & dataBase,const QString & host,
        const QString & user, const QString & passWord, const QString &connectionName); //建立一个连接

    bool insertLog(QString issue); //将issue插入到Log表的issue列

    QSqlQuery* query;
    bool isConnected;

    QString dbConnectionName;

    //QSqlQuery*  queryForTimer;
public slots:
    //void almostQuit(); //和abouttoquit（）相连
    void timerEventDBConnect();

signals:
    void sigErrorInfo(QString errorStr);

private:
    QTimer* timerForDBConnect; //该定时器用于保持与数据库的连接
};
#endif // DB_H
